/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author jerick
 */
@Entity
@Table(name = "empleado")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empleado.findAll", query = "SELECT e FROM Empleado e"),
    @NamedQuery(name = "Empleado.findByCodEmp", query = "SELECT e FROM Empleado e WHERE e.codEmp = :codEmp"),
    @NamedQuery(name = "Empleado.findByNomEmp", query = "SELECT e FROM Empleado e WHERE e.nomEmp = :nomEmp"),
    @NamedQuery(name = "Empleado.findByApeEmp", query = "SELECT e FROM Empleado e WHERE e.apeEmp = :apeEmp"),
    @NamedQuery(name = "Empleado.findByFechaIngEmp", query = "SELECT e FROM Empleado e WHERE e.fechaIngEmp = :fechaIngEmp"),
    @NamedQuery(name = "Empleado.findByUsuarioEmp", query = "SELECT e FROM Empleado e WHERE e.usuarioEmp = :usuarioEmp"),
    @NamedQuery(name = "Empleado.findByDni", query = "SELECT e FROM Empleado e WHERE e.dni = :dni")})
public class Empleado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CodEmp")
    private String codEmp;
    @Column(name = "NomEmp")
    private String nomEmp;
    @Column(name = "ApeEmp")
    private String apeEmp;
    @Basic(optional = false)
    @Column(name = "FechaIngEmp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaIngEmp;
    @Basic(optional = false)
    @Column(name = "usuarioEmp")
    private String usuarioEmp;
    @Basic(optional = false)
    @Column(name = "DNI")
    private String dni;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codEmp")
    private Collection<Pedido> pedidoCollection;

    public Empleado() {
    }

    public Empleado(String codEmp) {
        this.codEmp = codEmp;
    }

    public Empleado(String codEmp, Date fechaIngEmp, String usuarioEmp, String dni) {
        this.codEmp = codEmp;
        this.fechaIngEmp = fechaIngEmp;
        this.usuarioEmp = usuarioEmp;
        this.dni = dni;
    }

    public String getCodEmp() {
        return codEmp;
    }

    public void setCodEmp(String codEmp) {
        this.codEmp = codEmp;
    }

    public String getNomEmp() {
        return nomEmp;
    }

    public void setNomEmp(String nomEmp) {
        this.nomEmp = nomEmp;
    }

    public String getApeEmp() {
        return apeEmp;
    }

    public void setApeEmp(String apeEmp) {
        this.apeEmp = apeEmp;
    }

    public Date getFechaIngEmp() {
        return fechaIngEmp;
    }

    public void setFechaIngEmp(Date fechaIngEmp) {
        this.fechaIngEmp = fechaIngEmp;
    }

    public String getUsuarioEmp() {
        return usuarioEmp;
    }

    public void setUsuarioEmp(String usuarioEmp) {
        this.usuarioEmp = usuarioEmp;
    }

    public String getDni() {
        return dni;
    }

    public void setDni(String dni) {
        this.dni = dni;
    }

    @XmlTransient
    public Collection<Pedido> getPedidoCollection() {
        return pedidoCollection;
    }

    public void setPedidoCollection(Collection<Pedido> pedidoCollection) {
        this.pedidoCollection = pedidoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codEmp != null ? codEmp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empleado)) {
            return false;
        }
        Empleado other = (Empleado) object;
        if ((this.codEmp == null && other.codEmp != null) || (this.codEmp != null && !this.codEmp.equals(other.codEmp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spring.entidades.Empleado[ codEmp=" + codEmp + " ]";
    }
    
}
